package org.deva.erp.base.util;

import java.io.IOException;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

import org.primefaces.component.datatable.DataTable;
import org.primefaces.component.datatable.DataTableRenderer;

public class ERPDataTableRenderer extends DataTableRenderer {

	@Override
	public void encodeEnd(FacesContext context, UIComponent component) throws IOException {

        String reset =(String)component.getAttributes().get("reset");
        if(reset == null) {
            reset = "true";
        }
        DataTable dt = (DataTable) component;
        if(dt.isPaginator() && dt.isLazy() && reset.equals("true")){
            dt.reset();
        }
        super.encodeEnd(context, dt);
	}

}
